<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>CryptoAuthLib: sha1_routines.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">CryptoAuthLib
   </div>
   <div id="projectbrief">Microchip CryptoAuthentication Library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('a00350_source.html','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">sha1_routines.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="a00350.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="preprocessor">#ifndef __SHA1_ROUTINES_DOT_H__</span></div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="preprocessor">#define __SHA1_ROUTINES_DOT_H__</span></div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="preprocessor">#include &lt;stdio.h&gt;</span></div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="preprocessor">#include &lt;stdlib.h&gt;</span></div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="preprocessor">#include &lt;stddef.h&gt;</span></div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;</div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="preprocessor">#ifdef WIN32</span></div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="preprocessor">#include &lt;windows.h&gt;</span></div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="preprocessor">#include &lt;assert.h&gt;</span></div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="preprocessor">#include &lt;stdint.h&gt;</span></div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;</div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;<span class="preprocessor">#ifndef U8</span></div><div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="a00350.html#a2c0958af86f0590374e4324757c537f2">   44</a></span>&#160;<span class="preprocessor">#define U8 uint8_t</span></div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;<span class="preprocessor">#ifndef U16</span></div><div class="line"><a name="l00048"></a><span class="lineno"><a class="line" href="a00350.html#ad0b4d315e0f0b5d356886ec69d4bed08">   48</a></span>&#160;<span class="preprocessor">#define U16 uint16_t</span></div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;</div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;<span class="preprocessor">#ifndef U32</span></div><div class="line"><a name="l00052"></a><span class="lineno"><a class="line" href="a00350.html#a8f953f379d243081b950adb7f194b2e8">   52</a></span>&#160;<span class="preprocessor">#define U32 uint32_t</span></div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;</div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;</div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;<span class="preprocessor">#ifndef memcpy_P</span></div><div class="line"><a name="l00057"></a><span class="lineno"><a class="line" href="a00350.html#a3015d84f1e64c03564961de070d25328">   57</a></span>&#160;<span class="preprocessor">#define memcpy_P memmove</span></div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;<span class="preprocessor">#ifndef strcpy_P</span></div><div class="line"><a name="l00061"></a><span class="lineno"><a class="line" href="a00350.html#a3541bc4d0b928b2faa9ca63a100d1b75">   61</a></span>&#160;<span class="preprocessor">#define strcpy_P strcpy</span></div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;</div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;<span class="preprocessor">#ifndef _WDRESET</span></div><div class="line"><a name="l00065"></a><span class="lineno"><a class="line" href="a00350.html#a45e79c30522d47f4c30922b3d5b06b46">   65</a></span>&#160;<span class="preprocessor">#define _WDRESET()</span></div><div class="line"><a name="l00066"></a><span class="lineno"><a class="line" href="a00350.html#a46388d9db8422abfea56ae2323f7a77c">   66</a></span>&#160;<span class="preprocessor">#define _NOP()</span></div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;</div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;<span class="preprocessor">#ifdef __cplusplus</span></div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;<span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {</div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;</div><div class="line"><a name="l00073"></a><span class="lineno"><a class="line" href="a01101.html">   73</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct</span></div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;{</div><div class="line"><a name="l00075"></a><span class="lineno"><a class="line" href="a01101.html#a015ca0a234558a1a0dbfc1e92f547ac0">   75</a></span>&#160;    <a class="code" href="a00350.html#a8f953f379d243081b950adb7f194b2e8">U32</a> h[20 / 4];      <span class="comment">// Ensure it&#39;s word aligned</span></div><div class="line"><a name="l00076"></a><span class="lineno"><a class="line" href="a01101.html#afa9986c74d11cc23893e2de2a505cafe">   76</a></span>&#160;    <a class="code" href="a00350.html#a8f953f379d243081b950adb7f194b2e8">U32</a> buf[64 / 4];    <span class="comment">// Ensure it&#39;s word aligned</span></div><div class="line"><a name="l00077"></a><span class="lineno"><a class="line" href="a01101.html#a7dd834dde7d653957f91657aca4eb124">   77</a></span>&#160;    <a class="code" href="a00350.html#a8f953f379d243081b950adb7f194b2e8">U32</a> <a class="code" href="a01101.html#a7dd834dde7d653957f91657aca4eb124">byteCount</a>;</div><div class="line"><a name="l00078"></a><span class="lineno"><a class="line" href="a01101.html#a4f18b15c445fd0f55a0bf182e173d563">   78</a></span>&#160;    <a class="code" href="a00350.html#a8f953f379d243081b950adb7f194b2e8">U32</a> <a class="code" href="a01101.html#a4f18b15c445fd0f55a0bf182e173d563">byteCountHi</a>;</div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;} <a class="code" href="a01101.html">CL_HashContext</a>;</div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;</div><div class="line"><a name="l00081"></a><span class="lineno"><a class="line" href="a00350.html#a56a88d6165ee36c482ddc9b82826dd47">   81</a></span>&#160;<span class="preprocessor">#define leftRotate(x, n) (x) = (((x) &lt;&lt; (n)) | ((x) &gt;&gt; (32 - (n))))</span></div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;<span class="keywordtype">void</span> <a class="code" href="a00350.html#a6f06fe48f7cacc212305b862b46fd9aa">shaEngine</a>(<a class="code" href="a00350.html#a8f953f379d243081b950adb7f194b2e8">U32</a> *buf, <a class="code" href="a00350.html#a8f953f379d243081b950adb7f194b2e8">U32</a> *h);</div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;<span class="keywordtype">void</span> <a class="code" href="a00350.html#affa9482d686cc435d640d67d7fa79772">CL_hashInit</a>(<a class="code" href="a01101.html">CL_HashContext</a> *ctx);</div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;<span class="keywordtype">void</span> <a class="code" href="a00350.html#a55a33e7a22aff4aca4bccf39897bc5f1">CL_hashUpdate</a>(<a class="code" href="a01101.html">CL_HashContext</a> *ctx, <span class="keyword">const</span> <a class="code" href="a00350.html#a2c0958af86f0590374e4324757c537f2">U8</a> *src, <span class="keywordtype">int</span> nbytes);</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;<span class="keywordtype">void</span> <a class="code" href="a00350.html#a672902e6406b4e4e2af33c70ec7a001c">CL_hashFinal</a>(<a class="code" href="a01101.html">CL_HashContext</a> *ctx, <a class="code" href="a00350.html#a2c0958af86f0590374e4324757c537f2">U8</a> *dest);</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;<span class="keywordtype">void</span> <a class="code" href="a00350.html#a955169bbbce9b4712cafb9b7372b5ffa">CL_hash</a>(<a class="code" href="a00350.html#a2c0958af86f0590374e4324757c537f2">U8</a> *msg, <span class="keywordtype">int</span> msgBytes, <a class="code" href="a00350.html#a2c0958af86f0590374e4324757c537f2">U8</a> *dest);</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;<span class="preprocessor">#ifdef __cplusplus</span></div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;}</div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;<span class="preprocessor">#endif // __SHA1_ROUTINES_DOT_H__</span></div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;</div><div class="ttc" id="a00350_html_a2c0958af86f0590374e4324757c537f2"><div class="ttname"><a href="a00350.html#a2c0958af86f0590374e4324757c537f2">U8</a></div><div class="ttdeci">#define U8</div><div class="ttdef"><b>Definition:</b> sha1_routines.h:44</div></div>
<div class="ttc" id="a00350_html_a672902e6406b4e4e2af33c70ec7a001c"><div class="ttname"><a href="a00350.html#a672902e6406b4e4e2af33c70ec7a001c">CL_hashFinal</a></div><div class="ttdeci">void CL_hashFinal(CL_HashContext *ctx, U8 *dest)</div><div class="ttdoc">Complete the SHA1 hash in software and return the digest.</div><div class="ttdef"><b>Definition:</b> sha1_routines.c:140</div></div>
<div class="ttc" id="a00350_html_a55a33e7a22aff4aca4bccf39897bc5f1"><div class="ttname"><a href="a00350.html#a55a33e7a22aff4aca4bccf39897bc5f1">CL_hashUpdate</a></div><div class="ttdeci">void CL_hashUpdate(CL_HashContext *ctx, const U8 *src, int nbytes)</div><div class="ttdoc">Add arbitrary data to a SHA1 hash.</div><div class="ttdef"><b>Definition:</b> sha1_routines.c:62</div></div>
<div class="ttc" id="a01101_html_a4f18b15c445fd0f55a0bf182e173d563"><div class="ttname"><a href="a01101.html#a4f18b15c445fd0f55a0bf182e173d563">CL_HashContext::byteCountHi</a></div><div class="ttdeci">U32 byteCountHi</div><div class="ttdef"><b>Definition:</b> sha1_routines.h:78</div></div>
<div class="ttc" id="a01101_html_a7dd834dde7d653957f91657aca4eb124"><div class="ttname"><a href="a01101.html#a7dd834dde7d653957f91657aca4eb124">CL_HashContext::byteCount</a></div><div class="ttdeci">U32 byteCount</div><div class="ttdef"><b>Definition:</b> sha1_routines.h:77</div></div>
<div class="ttc" id="a00350_html_affa9482d686cc435d640d67d7fa79772"><div class="ttname"><a href="a00350.html#affa9482d686cc435d640d67d7fa79772">CL_hashInit</a></div><div class="ttdeci">void CL_hashInit(CL_HashContext *ctx)</div><div class="ttdoc">Initialize context for performing SHA1 hash in software.</div><div class="ttdef"><b>Definition:</b> sha1_routines.c:37</div></div>
<div class="ttc" id="a01101_html"><div class="ttname"><a href="a01101.html">CL_HashContext</a></div><div class="ttdef"><b>Definition:</b> sha1_routines.h:73</div></div>
<div class="ttc" id="a00350_html_a955169bbbce9b4712cafb9b7372b5ffa"><div class="ttname"><a href="a00350.html#a955169bbbce9b4712cafb9b7372b5ffa">CL_hash</a></div><div class="ttdeci">void CL_hash(U8 *msg, int msgBytes, U8 *dest)</div><div class="ttdoc">Perform SHA1 hash of data in software.</div><div class="ttdef"><b>Definition:</b> sha1_routines.c:213</div></div>
<div class="ttc" id="a00350_html_a6f06fe48f7cacc212305b862b46fd9aa"><div class="ttname"><a href="a00350.html#a6f06fe48f7cacc212305b862b46fd9aa">shaEngine</a></div><div class="ttdeci">void shaEngine(U32 *buf, U32 *h)</div><div class="ttdef"><b>Definition:</b> sha1_routines.c:222</div></div>
<div class="ttc" id="a00350_html_a8f953f379d243081b950adb7f194b2e8"><div class="ttname"><a href="a00350.html#a8f953f379d243081b950adb7f194b2e8">U32</a></div><div class="ttdeci">#define U32</div><div class="ttdef"><b>Definition:</b> sha1_routines.h:52</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_97aefd0d527b934f1d99a682da8fe6a9.html">lib</a></li><li class="navelem"><a class="el" href="dir_695be77052103537ae3c41f50bd7e0cc.html">crypto</a></li><li class="navelem"><a class="el" href="dir_39966be8f8e069f6fa92c98611834f6b.html">hashes</a></li><li class="navelem"><a class="el" href="a00350.html">sha1_routines.h</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.15 </li>
  </ul>
</div>
</body>
</html>
